package com.xy.biz.xd.domain.converter;

import com.xy.biz.xd.domain.bo.TechniqueDocumentBO;
import com.xy.biz.xd.domain.po.TechniqueDocumentPO;
import com.xy.biz.xd.domain.req.SaveTechniqueDocumentRequest;
import com.xy.biz.xd.domain.resp.GetTechniqueDocumentResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 * @author zgy
 * @date 2022-1-11
 */
public class TechniqueDocumentConverter {

	public static TechniqueDocumentPO toPO(TechniqueDocumentBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new TechniqueDocumentPO(), true);
	}

	public static List<TechniqueDocumentPO> toPO(Collection<TechniqueDocumentBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TechniqueDocumentPO(), true);
	}

	public static TechniqueDocumentBO fromPO(TechniqueDocumentPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new TechniqueDocumentBO());
	}

	public static List<TechniqueDocumentBO> fromPO(Collection<TechniqueDocumentPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TechniqueDocumentBO());
	}

	public static TechniqueDocumentBO toBO(SaveTechniqueDocumentRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new TechniqueDocumentBO(), true);
	}

	public static List<TechniqueDocumentBO> toBO(Collection<SaveTechniqueDocumentRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TechniqueDocumentBO(), true);
	}

	public static GetTechniqueDocumentResponse toResponse(TechniqueDocumentBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetTechniqueDocumentResponse());
	}

	public static List<GetTechniqueDocumentResponse> toResponse(Collection<TechniqueDocumentBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetTechniqueDocumentResponse());
	}

}
